<template>
	<page-wraper :safeAreaInsetBottom="false">
	</page-wraper>
</template>

<script lang="ts" setup>
	import { onLoad, onUnload } from '@dcloudio/uni-app';
	import { useToast } from '@/uni_modules/wot-design-uni';
	import { ref } from 'vue';
	
	const toast = useToast();

	onLoad((options) => {
		uni.$http.get(`/user/order/payment_check/${options.Ref}`).then(res => {
			if (res.data.code == 0) {
				const order_id = res.data.data.id;
				// const po_number = res.data.data.po_number;
				
				toast.success({
					msg: '支付成功',
					closed: () => {
						uni.redirectTo({ url: `/pages/order/Detail?id=${order_id}` });
					}
				});
			}
		});
	});

	onUnload(() => {
		const backUrl = uni.getStorageSync('backUrl');

		if (backUrl) {
			uni.setStorageSync('backUrl', '/pages/order/Index');
		}
	})
</script>

<style lang="scss" scoped>
	:deep(.page-wraper) {
		background: #f6f6f6;
	}
</style>